﻿<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
	xmlns:igWindows="http://infragistics.com/Windows"     
	xmlns:igDP="http://infragistics.com/DataPresenter" mc:Ignorable="d"
	x:Class="TVersiPlay.AppSettings.Views.AppSettingsView"	
    xmlns:local="clr-namespace:TVersiPlay.AppSettings.Panels"
	x:Name="UserControl"             
	d:DesignWidth="640" d:DesignHeight="480"
    HorizontalAlignment="Stretch"
             Width="Auto"
             Height="Auto">

    <UserControl.Resources>
        <Style TargetType="Image" x:Key="ServerImage">
            <Setter Property="Stretch" Value="Fill" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding Path=IsActive}" Value="False">
                    <Setter Property="Source" Value="/TVersiPlay.AppSettings;component/Resources/finger.png" />
                    <Setter Property="ToolTip" Value="Click to connect to this TVersity media server" />
                </DataTrigger>
                <DataTrigger Binding="{Binding Path=IsActive}" Value="True">
                    <Setter Property="Source" Value="/TVersiPlay.AppSettings;component/Resources/checkmark.png" />
                    <Setter Property="ToolTip" Value="Current connected TVersity media server" />
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <Style TargetType="Grid" x:Key="ServerToolTip">
            <Style.Triggers>
                <DataTrigger Binding="{Binding Path=IsActive}" Value="False">
                    <Setter Property="ToolTip" Value="Click to connect to this TVersity media server" />
                </DataTrigger>
                <DataTrigger Binding="{Binding Path=IsActive}" Value="True">
                    <Setter Property="ToolTip" Value="Current connected TVersity media server" />
                </DataTrigger>
            </Style.Triggers>
        </Style>


        <DataTemplate  x:Key="AvailableServerItemTemplate">
            <Border BorderThickness="4" CornerRadius="5" BorderBrush="Silver" >
                <Grid HorizontalAlignment="Stretch">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="25" />
                    </Grid.RowDefinitions>

                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="25" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <Button Background="DarkGray" MaxHeight="25" MaxWidth="25" Margin="5,0,0,0" 
                            Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ItemsControl}}, Path=DataContext.ServerSelected}" 
                            CommandParameter="{Binding}">
                        <Button.Content>
                            <Image Style="{StaticResource ServerImage}"/>
                        </Button.Content>
                    </Button>
                    <Label Grid.Column="1" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" Content="{Binding Path=FriendlyName}">
                        <Label.Foreground>
                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                <GradientStop Color="#FFF8FFDB" Offset="0.385"/>
                                <GradientStop Color="#FFC28707" Offset="1"/>
                            </LinearGradientBrush>
                        </Label.Foreground>
                    </Label>
                </Grid>
            </Border>
        </DataTemplate>
    </UserControl.Resources>

    <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="Black">
        <Path
            Fill="#FFBC7C7C"
            Stretch="Fill"
            Stroke="#FF000000"
            HorizontalAlignment="Right"
            Margin="0"
            x:Name="customPath"
            Width="Auto"
            Grid.RowSpan="1"
            Data="M202,26L202,339"
            Visibility="Hidden"/>
        <igWindows:XamCarouselPanel HorizontalAlignment="Stretch" Margin="20">
            <igWindows:XamCarouselPanel.ViewSettings>
                <igWindows:CarouselViewSettings
                    AutoScaleItemContentsToFit="True"
                    IsListContinuous="True"                    
                    ItemPath="{Binding ElementName=customPath, Mode=OneWay}"
                    ItemPathAutoPad="False"
                    ItemPathPadding="0,0,0,0"
                    ItemSize="400,300"
                    ItemPathPrefixPercent="0"
                    ItemPathSuffixPercent="0"
                    ItemsPerPage="3"
                    ReserveSpaceForReflections="True"
                    UseOpacity="True"                    
                    UseZOrder="True"                    
                    ItemPathHorizontalAlignment="Stretch"
                    ItemPathVerticalAlignment="Stretch">
                    <igWindows:CarouselViewSettings.OpacityEffectStops>
                        <igWindows:OpacityEffectStopCollection>
                            <igWindows:OpacityEffectStop/>
                            <igWindows:OpacityEffectStop Offset="0.3" Value="0.3"/>
                            <igWindows:OpacityEffectStop Offset="0.5" Value="1"/>
                            <igWindows:OpacityEffectStop Offset="0.7" Value="0.3"/>
                            <igWindows:OpacityEffectStop Offset="1"/>
                        </igWindows:OpacityEffectStopCollection>
                    </igWindows:CarouselViewSettings.OpacityEffectStops>
                    <igWindows:CarouselViewSettings.ScalingEffectStops>
                        <igWindows:ScalingEffectStopCollection>
                            <igWindows:ScalingEffectStop/>
                            <igWindows:ScalingEffectStop Offset="0.3" Value="0.5"/>
                            <igWindows:ScalingEffectStop Offset="0.5" Value="1.5"/>
                            <igWindows:ScalingEffectStop Offset="0.7" Value="0.5"/>
                            <igWindows:ScalingEffectStop Offset="1"/>
                        </igWindows:ScalingEffectStopCollection>
                    </igWindows:CarouselViewSettings.ScalingEffectStops>
                </igWindows:CarouselViewSettings>
            </igWindows:XamCarouselPanel.ViewSettings>

            <Button Background="Red" Width="200" Height="200" />

            <Border VerticalAlignment="Stretch" CornerRadius="2" BorderThickness="4" BorderBrush="White">
                <Grid x:Name="AvailableServersPanel" Width="500" Height="400">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <Label Grid.Row="0" FontSize="16" Foreground="WhiteSmoke" Content="Avialable TVersity Media Servers" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" Margin="0,0,0,10"/>

                    <ItemsControl Grid.Row="1" VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" HorizontalAlignment="Stretch"  ItemTemplate="{StaticResource AvailableServerItemTemplate}" ItemsSource="{Binding Path=AvailableServers}">

                    </ItemsControl>
                </Grid>
            </Border>
            
            <Button Background="Green" Width="200" Height="200" />

            <Button Background="Blue" Width="200" Height="200" />

            <Button Background="Purple" Width="200" Height="200" />

        </igWindows:XamCarouselPanel>
    </Grid>
</UserControl>